import request from '@/utils/request'

/** 数据上报 */
export function report(
  eventId: string,
  data: object,
  headers: object = {},
): Promise<any> {
  return request({
    url: `/api/v1/report?event_id=${eventId}`,
    method: 'post',
    data,
    headers,
  })
}
/** 可视化曝光数据上报 */
export function viewReport(
  ref: string,
  uri: string,
  eventId: string,
  data: object,
): Promise<any> {
  const pageReqId = `${new Date().getTime()}-${newUIID(36, 128)}`
  return request({
    url: `/api/v2/report?event_id=${eventId}`,
    method: 'post',
    data,
    headers: {
      'page-ref': ref,
      'page-req-id': pageReqId,
      'page-uri': uri,
    },
  })
}
